<template>
  <div class="newsinfo-container"> 

    <h3 class="title">{{ newsinfo.title }}</h3>
    <p class="subtitle">
      <span>发表时间:{{ newsinfo.add_time | dateFormat }}</span>
      <span>点击:{{ newsinfo.click }}次</span>
    </p>

    <hr>

    <div class="content" v-html="nresinfo.content"></div>
<!-- 父组件向子组件传值 -->
    <coooment-box :id="this.id"></coooment-box>
  </div>
</template>

<style lang="scss" scope d>
  
</style>

<script>
import {Toast} from "mint-ui"
import comments from '../subcomponents/comment'

export default{
  data(){
    return{
      id:this.$router.paramas.id,
      newsinfo:[]
    }
  },
  created(){
    this.getNewsInfo()
    },
  methods:{
    getNewsInfo(){
      this.$http.get("api/getnewsinfo"+ this.id).then(result=>{
        if(result.body.status===0){
          this.newsList=result.body.message;
          // Toast("图片加载失败")
        }else{
          Toast("图片加载失败")
        }
      })
    }
    },
  components:{
    'comment-box':comments
    }
  }
</script>